function GetServiceGroups() {
		var myData =[
		{
			Name:'Service Object',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'any',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'},
				{Name:'test',Protocol:'tcp',SourcePorts:'56',DestinationPorts:'12',ICMP:'',Description:'test',iconCls:'tcp'}
			]
		},{
			Name:'Service Groups',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'test',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'test',iconCls:'tcp',children:[
					{Name:'rew',Protocol:'icmp',SourcePorts:'',DestinationPorts:'',ICMP:'8/255',Description:'',iconCls:'tcp'},
					{Name:'aol',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'5190',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'bgp',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'179',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'chargen',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'19',ICMP:'',Description:'',iconCls:'tcp'}
					
				]
				}
			]
		},{
			Name:'TCP Service Groups',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'Admin-services',Protocol:'tcp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'finger',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'79',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'ftp',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'21',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'https',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'443',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'ssh',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'23',ICMP:'',Description:'',iconCls:'tcp'}
					
				]
				},{Name:'HTTP-services',Protocol:'tcp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'http',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'80',ICMP:'',Description:'all http service',iconCls:'tcp'},
					{Name:'https',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'443',ICMP:'',Description:'',iconCls:'tcp'}
				]
				},{Name:'Mail-services',Protocol:'tcp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'all email service',iconCls:'tcp',children:[
					{Name:'imap4',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'143',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'pop2',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'109',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'pop3',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'110',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'smtp',Protocol:'tcp',SourcePorts:'default(1-65535)',DestinationPorts:'25',ICMP:'',Description:'',iconCls:'tcp'}
					
				]
				}
			]
		},{
			Name:'UDP Service Groups',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'Predefined-UDP-group',Protocol:'udp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'biff',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'512',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'bootpc',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'68',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'bootps',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'67',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'cifs',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'3020',ICMP:'',Description:'',iconCls:'tcp'}
					
				]
				},{Name:'all-udp-services',Protocol:'udp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'http',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'80',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'tftp',Protocol:'udp',SourcePorts:'default(0-65535)',DestinationPorts:'69',ICMP:'',Description:'',iconCls:'tcp'}
				]
				}
			]
		},{
			Name:'ICMP Groups',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'ping-service',Protocol:'icmp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'echo',Protocol:'icmp',SourcePorts:'',DestinationPorts:'',ICMP:'8',Description:'',iconCls:'tcp'}
					
				]
				}
			]
		},{
			Name:'Protocol Groups',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'blank',expanded: true,children:[
				{Name:'VPN-protocol',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'gre',Protocol:'gre',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'esp',Protocol:'esp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'ah',Protocol:'ah',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'}
					
				]
				},{Name:'routing-protocol',Protocol:'',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp',children:[
					{Name:'eigrp',Protocol:'eigrp',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'},
					{Name:'ospf',Protocol:'ospf',SourcePorts:'',DestinationPorts:'',ICMP:'',Description:'',iconCls:'tcp'}
				]
				}
			]
		}
    ]

	var ServiceGroupsMenu = new Ext.menu.Menu({
        id: 'ServiceGroupsMenu',
        style: {
            overflow: 'visible'     // For the Combo popup
        },
        items: [
        	{
						text : 'Service Object...',
						tooltip : 'Service Object',
						handler : function() {
								SetServiceObject();
						}
					},{
						text : 'Service Groups...',
						tooltip : 'Service Groups',
						handler : function() {
								SetServiceGroups();
						}
					},'-',
					{
						text : 'TCP Service Groups...',
						tooltip : 'TCP Service Groups',
						handler : function() {
							SetTCPServiceGroups();
						}
					},
					{
						text : 'UDP Service Groups...',
						tooltip : 'UDP Service Groups',
						handler : function() {
							SetUDPServiceGroups();
						}
					},
					{
						text : 'TCP-UDP Service Groups...',
						tooltip : 'TCP-UDP Service Groups',
						handler : function() {
							SetTCPUDPServiceGroups();
						}
					},
					{
						text : 'IMCP Groups...',
						tooltip : 'IMCP Groups',
						handler : function() {
							SetIMCPGroups();
						}
					},
					{
						text : 'Protocol Groups...',
						tooltip : 'Protocol Groups',
						handler : function() {
							SetProtocolGroups();
						}
					}
        ]
    });
    

			
    var tree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        renderTo: Ext.getBody(),
        enableDD: true,
        columns:[{
            header: '名称',
            dataIndex: 'Name',
            width: 200
        },{
            header: '协议',
            width: 100,
            dataIndex: 'Protocol'
        },{
            header: '源端口',
            width: 150,
            dataIndex: 'SourcePorts'
        },{
            header: '目的端口',
            width: 150,
            dataIndex: 'DestinationPorts'
        },{
            header: 'ICMP',
            width: 150,
            dataIndex: 'ICMP'
        },{
            header: '描述',
            width: 150,
            dataIndex: 'Description'
        }],
        tbar : [{
				            text:'添加',
				            iconCls: 'add', 
				            menu: ServiceGroupsMenu  
				        }, '-', {
									text : '编辑',
									tooltip : '编辑',
									iconCls : 'modify',
									ref : '../modifyBtn',
									id:'modifyBtn',
									name:'modifyBtn',
									handler : function() {
										SetDeviceinfo();
									}
								}, '-', {
									text : '删除',
									tooltip : '删除',
									iconCls : 'delete',
									ref : '../removeBtn',
									disabled : true,
									handler : function() {
										var s = grid.getSelectionModel().getSelections();
										for (var i = 0; r = s[i]; i++) {
											store.remove(r);
										}
									}
								}, '-', {
									text : '刷新',
									tooltip : '刷新',
									iconCls : 'refresh',
									handler : function() {							
										store.loadData(myData);
									}
							  }]
    });
    
	  tree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var root = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		tree.setRootNode(root);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function appendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     Protocol:o.children[a].Protocol,
				     SourcePorts:o.children[a].SourcePorts,
				     DestinationPorts:o.children[a].DestinationPorts,
				     SourcePorts:o.children[a].SourcePorts,
				     ICMP:o.children[a].ICMP,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    appendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	appendChild(root, nodes);    
    
    
	
	return tree;	
}
function SetServiceObject()
{
	
	
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];
	
	var Search = new Ext.form.FormPanel({
				frame : true,
				layout : 'form',
				region : 'center',
				xtype : 'fieldset',
				bodyStyle : 'padding:0px;',
				labelWidth: 150,   
				items : [						
						{
								xtype : 'textfield',
								fieldLabel : 'Name',
								id : 'Name',
								name : 'Name',
								anchor : '100%'
						}  ,{
																		fieldLabel: 'Service Type',
																		xtype : 'combo',
																		name : 'ServiceType',
																		frame : true,
																		id : 'ServiceType',
																		store : new Ext.data.ArrayStore({
																				fields : ['abbr', 'state'],
																				data : states
																			}),
																		valueField : 'abbr',
																		displayField : 'state',
																		typeAhead : true,
																		mode : 'local',
																		triggerAction : 'all',
																		value : '1',
																		editable : false,
																		anchor: '100%'
																  },
						{
								xtype : 'textfield',
								fieldLabel : 'Destination Port/Range',
								id : 'DestinationPort',
								name : 'DestinationPort',
								anchor : '100%'
						},
						{
								xtype : 'textfield',
								fieldLabel : 'Source Port/Range',
								id : 'SourcePort',
								name : 'SourcePort',
								anchor : '100%'
						},
						{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description',
								name : 'Description',
								anchor : '100%'
						}
						]

			});


	var searchWindows = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 250,
				title : "Add Service Object",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'search',
				items : [Search],
				plain : true
			});
	searchWindows.addButton({
				text : "OK",
				handler : function() {
					
					searchWindows.close();
				}
			});
	searchWindows.addButton({
				text : 'Cancel',
				handler : function() {
					searchWindows.close();
				}
			});
	searchWindows.show();
}

function SetServiceGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'Service Object',iconCls:'blank',expanded: true,children:[
				{Name:'rwe',iconCls:'tcp'},
				{Name:'test',iconCls:'tcp'}
			]
		},{
			Name:'Service Groups',iconCls:'blank',expanded: true,children:[
				{Name:'ser12',iconCls:'tcp',children:[
					{Name:'rwe',iconCls:'tcp'},
					{Name:'aol',iconCls:'tcp'},
					{Name:'bgp',iconCls:'tcp'},
					{Name:'chargen',iconCls:'tcp'}
					
				]
				}
			]
		},{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'Name',
																id : 'name',
																name : 'name',
																anchor : '100%'
														},{
																fieldLabel: 'Service Type',
																xtype : 'combo',
																name : 'type',
																frame : true,
																id : 'type',
																store : new Ext.data.ArrayStore({
																		fields : ['abbr', 'state'],
																		data : states
																	}),
																valueField : 'abbr',
																displayField : 'state',
																typeAhead : true,
																mode : 'local',
																triggerAction : 'all',
																value : '3',
																editable : false,
																anchor: '100%'
														},{
																xtype : 'textfield',
																fieldLabel : 'Destination Port/Range',
																id : 'Destination',
																name : 'Destination',
																anchor : '100%'
														},{
																xtype : 'textfield',
																fieldLabel : 'Sources Port/Range',
																id : 'Sources',
																name : 'Sources',
																anchor : '100%'
														},{
																xtype : 'textfield',
																fieldLabel : 'Description',
																id : 'Description',
																name : 'Description',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add Service Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();
}

function SetTCPServiceGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'TCP Service Groups',iconCls:'blank',expanded: true,children:[
				{Name:'HTTP-service',iconCls:'tcp',children:[
					{Name:'http',iconCls:'tcp'},
					{Name:'https',iconCls:'tcp'}					
				]
				},{Name:'Mail-service',iconCls:'tcp',children:[
					{Name:'imap4',iconCls:'tcp'},
					{Name:'pop2',iconCls:'tcp'},
					{Name:'pop3',iconCls:'tcp'},
					{Name:'smtp',iconCls:'tcp'}					
				]
				}
			]
		},{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'Prot/Range',
																id : 'Range',
																name : 'Range',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add TCP Service Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();
	}
	
function SetUDPServiceGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'UDP Service Groups',iconCls:'blank',expanded: true,children:[
				{Name:'Predefine-UDP-group',iconCls:'tcp',children:[
					{Name:'bootpc',iconCls:'tcp'},
					{Name:'bootps',iconCls:'tcp'}					
				]
				},{Name:'all_udp-service',iconCls:'tcp',children:[
					{Name:'echo',iconCls:'tcp'},
					{Name:'http',iconCls:'tcp'},
					{Name:'domain',iconCls:'tcp'},
					{Name:'dnsix',iconCls:'tcp'}					
				]
				}
			]
		},{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'Prot/Range',
																id : 'Range',
																name : 'Range',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add UDP Service Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();
}
function SetTCPUDPServiceGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'Prot/Range',
																id : 'Range',
																name : 'Range',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add TCP-UDP Service Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();	
	
}

function SetIMCPGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'ICMP Groups',iconCls:'blank',expanded: true,children:[
				{Name:'ping-service',iconCls:'tcp',children:[
					{Name:'echo',iconCls:'tcp'}				
				]
				}
			]
		},{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'ICMP Type',
																id : 'Range',
																name : 'Range',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add ICMP Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();
}
function SetProtocolGroups(){

 	var topPanel = new Ext.form.FormPanel({
 				frame : true,
				layout : 'form',
        height: 80,
        region : 'north',
        items: [
						{
								xtype : 'textfield',
								fieldLabel : 'Group Name',
								id : 'groupname',
								name : 'groupname',
								anchor : '100%'
						},{
								xtype : 'textfield',
								fieldLabel : 'Description',
								id : 'Description1',
								name : 'Description1',
								anchor : '100%'
						}           
        ]
    });
var myData =[
		{
			Name:'Protocol Groups',iconCls:'blank',expanded: true,children:[
				{Name:'VPN-protocols',iconCls:'tcp',children:[
					{Name:'gre',iconCls:'tcp'},
					{Name:'esp',iconCls:'tcp'},
					{Name:'ah',iconCls:'tcp'}					
				]
				},{Name:'routing-protocols',iconCls:'tcp',children:[
					{Name:'eigrp',iconCls:'tcp'},
					{Name:'ospf',iconCls:'tcp'},
					{Name:'igrp',iconCls:'tcp'}					
				]
				},{Name:'vpn-routing-protocols',iconCls:'tcp',children:[
					{Name:'gre',iconCls:'tcp'},
					{Name:'esp',iconCls:'tcp'},
					{Name:'ah',iconCls:'tcp'},
					{Name:'eigrp',iconCls:'tcp'},
					{Name:'ospf',iconCls:'tcp'},
					{Name:'igrp',iconCls:'tcp'}				
				]
				}
			]
		},{
			Name:'Predefined',iconCls:'blank',expanded: true,children:[
				{Name:'aol',iconCls:'tcp'},
				{Name:'bgp',iconCls:'tcp'},
				{Name:'cifs',iconCls:'tcp'},
				{Name:'echo',iconCls:'tcp'}
			]
		}
    ]
    var grouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        height : 200,
        width: 350,
        
        region : 'center',
        title:'Exising Srvice/Srvice Groups:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            width: 200
        }]
       
    });
    
	  grouptree.on("nodedragover", function(e){         
	  	       
	  	return false;     
	  }); 
	  
   	var grouproot = new Ext.tree.TreeNode({
        text: '根节点',
        draggable : false,
        expanded: true
    });
 		grouptree.setRootNode(grouproot);
 
  	var nodes = {}; 
  	nodes.children = myData;
	 	function groupappendChild(node, o){
	  	if (o.children != null && o.children.length > 0) {
	   		for (var a = 0; a < o.children.length; a++) {  			
				    var n = new Ext.tree.TreeNode({
				     Name:o.children[a].Name,
				     iconCls:o.children[a].iconCls,
				     expanded:o.children[a].expanded
				    });
				    node.appendChild(n);
				    groupappendChild(n, o.children[a]);
	  		
	  			
	   		}
	  	}
	 	}
	 	groupappendChild(grouproot, nodes);    
	var states = [
		['1', 'tcp'],
		['2', 'udp'],
		['3', 'icmp'],
		['4', 'icmp6'],
		['5', 'protocol']
		];

	var selgrouptree = new Ext.ux.tree.TreeGrid({
        dropConfig: {appendOnly:false},
        width: 320,
        region : 'center',
        title:'Members in Group:',
        columns:[{
            header: 'Name',
            dataIndex: 'Name',
            sortable:false,
            width: 200
        }]
       
    });

        var nav = new Ext.Panel({
            region : 'west',
						layout : 'border',
						width: 400,
						items : [						
										grouptree,{
		                region:'south',
		                layout : 'form',
		                height : 200,
		                title:'Create new member:',
		                labelWidth: 150, 
		                bodyStyle:'padding:5px 5px 5px 5px',
		                items:[{
																xtype : 'textfield',
																fieldLabel : 'Protocol',
																id : 'Protocol',
																name : 'Protocol',
																anchor : '100%'
														}]
		            		}
								]

        });
        var nav1 = new Ext.Panel({
            region: 'east',
            layout : 'border',
            width: 330,
						items : [						
													 selgrouptree
						]
        }); 
        var nav2 = new Ext.Panel({
            layout:'vbox',
						region : 'center',
						width : 70,
						layoutConfig: {
		              padding:'0',
		              pack:'center',
		              align:'middle'
		        },
						items : [						{ 
												            xtype:"button", width : 70,text:"Add >>"
												        },
												        { 
												            xtype:"button", width : 70,text:"Remove <<<"
												        }
								]
        });

	var groupWindows = new Ext.Window({
				layout : 'border',
				width : 820,
				height : 600,
				title : "Add Protocol Group",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'add',
				items : [topPanel,nav,nav1,nav2],
				plain : true
			});
	groupWindows.addButton({
				text : "OK",
				handler : function() {
					
					groupWindows.close();
				}
			});
	groupWindows.addButton({
				text : 'Cancel',
				handler : function() {
					groupWindows.close();
				}
			});
	groupWindows.show();
}